home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / LISTINGS / V_12_12 / ALLISON.ZIP / EXCEPT.CPP < prev    next >
Encoding:
Text File  |  1994-10-05  |  382 b   |  25 lines

  1. LISTING 4 - Illustrates the semantics of an exception specification
  2.  
  3. // The following is equivalent to:
  4. //     void f() throw(A,B) {}
  5.  
  6. void f()
  7. {
  8.     try
  9.     {
  10.         // Whatever
  11.     }
  12.     catch(A)
  13.     {
  14.         throw;          // rethrow
  15.     }
  16.     catch(B)
  17.     {
  18.         throw;          // rethrow
  19.     }
  20.     catch(...)
  21.     {
  22.         unexpected();
  23.     }
  24. }
  25.